import cv2
import matplotlib.pyplot as plt
import numpy as np

# matplotlib 可以显示图像，但是显示的图像通道与opencv通道方向相反
# cv2 : BGR
# plt : RGB
img = cv2.imread("./img/opencv-logo.png")

black = np.zeros(img.shape, dtype=np.uint8)
red_img = black.copy()
green_img = black.copy()
blue_img = black.copy()

red_img[:, :, 0] = img[:, :, 2]
blue_img[:, :, 2] = img[:, :, 0]
green_img[:, :, 1] = img[:, :, 1]

ax1 = plt.subplot(131)
ax1.imshow(red_img)
ax2 = plt.subplot(132)
ax2.imshow(green_img)
ax3 = plt.subplot(133)
ax3.imshow(blue_img)

plt.show()
